package com.travelmood.service;

import com.travelmood.pojo.Image;
import com.travelmood.mapper.ImageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ImageService {

    @Autowired
    private ImageMapper imageMapper;

    public void addImage(Image image) {
        imageMapper.insertImage(image);
    }

    public void updateImage(Image image) {
        imageMapper.updateImage(image);
    }

    public void deleteImageById(Integer imageId) {
        imageMapper.deleteImageById(imageId);
    }

    public Image findImageById(Integer imageId) {
        return imageMapper.findImageById(imageId);
    }

    public List<Image> getAllImages() {
        return imageMapper.getAllImages();
    }

    public List<Image> findImagesByPlaceId(Integer placeId) {
        return imageMapper.findImagesByPlaceId(placeId);
    }
}

